# 多继承: 在Python中，一个类可以继承多个父类，这称为多继承。
class Animal:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print(f"{self.name} is eating.")

    def sleep(self):
        print(f"{self.name} is sleeping.")

    def jump(self):
        print(f"{self.name} is jumping.")

class Dog(Animal):
    def bark(self):
        print(f"{self.name} is barking.")
    def money(self):
        print(f"{self.name} is a rich dog.- 100w")

class Snoopy(Dog):
    def __init__(self, name):
        super().__init__(name)  # 调用父类的构造方法
        self.breed = "Beagle"  # Snoopy特有的属性

    def bark(self):
        Dog.bark(self) # 调用父类Dog的bark方法
        print(f"{self.name} the {self.breed} is barking happily.")

    def eat(self):
        Dog.eat(self) # 继承父类的方式一: 调用父类Dog的bark方法
        print(f"{self.name} is eating dog food.")

    def sleep(self):
        super().sleep() # 继承父类的方式二: 调用父类Animal的sleep方法
        print(f"{self.name} is sleeping peacefully.")

    def run(self):
        print(f"{self.name} is running around happily.")

    def jump(self):
        print(f"{self.name} is jumping high in the air.")

    def money(self):
        super(Snoopy,self).money() # 继承父类的方式三
        print(f"{self.name} is a rich dog. - 1000w")

snoopy = Snoopy("Snoopy")
snoopy.eat()
snoopy.sleep()
snoopy.bark()
snoopy.run()
snoopy.jump()
snoopy.money()

# super() 函数: 用于调用父类的方法, 可以在子类中调用父类的方法
# super() 就是使用父类的构造方法来初始化子类的属性

# 调用父类的三种形式